package com.github.ecbp.common.data.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;

public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T> {
    /**
     * 逻辑删除且添加更新字段
     *
     * @param entity
     * @return
     */
    int deleteByIdWithFill(T entity);

    int deleteBatchByIdsWithFill(@Param(Constants.ENTITY) T entity, @Param(Constants.COLLECTION) Collection<? extends Serializable> idList);

    int deleteWithFill(@Param(Constants.ENTITY) T entity, @Param(Constants.WRAPPER) Wrapper<T> wrapper);

    /**
     * 使用上面的两个或者service接口中的方法
     * @param id
     * @return
     */
    @Override
    @Deprecated
    int deleteById(Serializable id);

    @Override
    @Deprecated
    int deleteByMap(@Param(Constants.COLUMN_MAP) Map<String, Object> columnMap);

    @Override
    @Deprecated
    int delete(@Param(Constants.WRAPPER) Wrapper<T> wrapper);

    @Override
    @Deprecated
    int deleteBatchIds(@Param(Constants.COLLECTION) Collection<? extends Serializable> idList);
}
